<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div class="box">
       
    </div>

    <script>
        //学生组件
        const student = Vue.extend({
            template: `
            <div>
                <h1>学生姓名：{{schoolname}}</h1>
                <h1>学生年龄：{{age}}</h1>
            </div>
            `,
            data(){
                return {
                    schoolname:'蔡徐坤',
                    age:2.5
                }
            }
        })
        //学校组件
        const school = Vue.extend({
            template: `
            <div>
                <h1>学校名称：{{schoolname}}</h1>
                <h1>学校年龄：{{age}}</h1>
                <student></student>
            </div>
            `,
            data(){
                return {
                    schoolname:'坤坤大学',
                    age:3
                }
            },
            components:{
                student:student
            }
        })
        const app = Vue.extend({
            template:`
                <school></school>
            `,
            components:{
                school:school
            }
        })
        new Vue({
            template:`
                <app></app>
            `,
            el: '.box',
            components:{
                app,
            }
        })
    </script>
</body>

</html>